Rust optimizations
Achieving warp speed with Rust
【翻訳】Rustにおけるパフォーマンスの落とし穴
Rust Performance Pitfalls
Improve your algorithms
remember that every use of collect has to iterate over the entire collection at least once
diffirent computer -> RAM -> CPU cache
you should avoid indirection-heavy representations Vec<Vec<_>> to represent a matrix, since this means that each sub-vec will likely be in a different location.
Essentially, the less pointers you have to write at runtime the better. Writing to local variables is better than writing through a mutable pointer. As much as possible, you should try to constrain mutable writes to the data that you have ownership over. So a mutable loop counter is fine, but passing a mutable reference to a loop counter through multiple layers of functions is not (unless they end up getting inlined, of course).
Rust Performance: A story featuring perf and flamegraph on Linux
Rustの3種のべき乗演算の速度差について